var recuperarClass = {
	parent: "parentId",
	pattern: "4H",
	win: null,
	form: null,
	grid: null,
	actionBar: null,
	layout: null,
	BoleCod: null,
	PregCod: null,
	widgetWin: function(){
		var windows = new dhtmlXWindows();
		this.win = windows.createWindow('window_1', 0, 0, 300, 180);
		this.win.setText('Recuperar');
		this.win.clearIcon();
		this.win.button('park').hide();
		this.win.button('minmax1').hide();
		this.win.denyResize();
		this.win.setModal(1);
		this.win.centerOnScreen();
		this.layout = this.win.attachLayout('1C');
	},
	widgetForm: function(valor,ruta){
		var panel = this.layout.cells('a');
		panel.setWidth('200');
		panel.hideHeader();
		var str = [
			{ type:"label" , name:"form_label_1", label:"Nombre:", labelLeft:20, labelTop:0, position:"absolute"  },
			{ type:"input" , name:"usuario", inputWidth:250, inputHeight:20, inputLeft:20, inputTop:20, position:"absolute"},
            { type:"label" , name:"form_label_2", label:"Correo:", labelLeft:20, labelTop:40, position:"absolute"  },
            { type:"input" , name:"mail", inputWidth:250, inputHeight:20, inputLeft:20, inputTop:65, position:"absolute"},
            { type:"button", name:"send", label:"Button", value:"Enviar", width:"75", inputWidth:75, inputLeft:193, inputTop:105,position:"absolute"  }
		];
		var me = this;	    
		me.form = panel.attachForm(str);
        me.form.disableItem("usuario");
        me.form.disableItem("mail");
        me.form.send(ruta + "index.php/Usuarios/Usu2_data?usu_login="+valor, function(loader, response){
            var datos=response.split(',');
            me.form.setItemValue("usuario", datos[0]+" "+datos[1]+" "+datos[2]);
            me.form.setItemValue("mail", datos[3]);
            dhtmlx.alert("Al presionar el boton de Enviar se le enviaran sus datos a la direccion de correo proporcionada");
        });
        me.form.attachEvent("onButtonClick", function (name) {
            switch (name) {
                case 'send':
                    me.form.disableItem("send");
                    me.form.send(ruta + "index.php/mail/Envio_pass?usu_login="+valor, function(loader, response) {
                        dhtmlx.alert(response);
                        me.win.close();
                    });
                break;
            }
        });
	},		

	widgetMain: function(valor,ruta){
        var me =this;
        var formData = {usu_login: valor};
        $.ajax({
            type: "GET",
            url: ruta + "index.php/Usuarios/Usu2_data",
            data: formData,
            success: function(response)
            {
                if(response==0){
                    dhtmlx.alert("El usuario no existe");
                }
                else{
                    me.widgetWin();
                    me.widgetForm(valor,ruta);
                }
            }
        });
	}
};